From 2aad19f4341162438a4534c130b7cd1c2ac28343 Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 21 Jul 2009 05:18:37 +0000 Subject: [PATCH] track_recompute: don't recompute speed if we already have it. --- route.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/route.c b/route.c index 255129ad7..e6f8b1ff6 100644 --- a/route.c +++ b/route.c @@ -565,10 +565,15 @@ void track_recompute(const route_head *trk, computed_trkdata **trkdatap) } /* - * If we've moved as much as a meter, recompute speed. + * If we've moved as much as a meter, + * conditionally recompute speeds. */ if (timed && (dist > 1)) { - WAYPT_SET(this, speed, dist / labs(timed)); + if(!WAYPT_HAS(this, speed)) { + // Only recompute speed if the waypoint + // didn't already have a speed + WAYPT_SET(this, speed, dist / labs(timed)); + } if (this->speed > tdata->max_spd) { tdata->max_spd = this->speed; } -- 2.30.2